<?php

class my_letter_form_helper extends \swap\helper {
    
    public static function run($context) {
        
        $show = false;
        $action = array('my-letter/do_new');
        $button = '新 建';
        
        if (isset($context['letter'])) {
            $show = true;
            $action = array('my-letter/do_edit', array('id' => $context['letter']->id));
            $button = '编 辑';
            
            self::set('letter', $context['letter']);
        }
        
        self::set('show', $show);
        self::set('action', $action);
        self::set('button', $button);
        
        self::render();
    }
    
}